import { IParam } from '@/core';
import type { PropType } from 'vue';

interface CardOptions {
	width: number;
	height: number;
	cardColXS: number;
	cardColSM: number;
	cardColMD: number;
	cardColLG: number;
}

//  卡片视图输入参数
const dataViewProps = {
	items: {
		type: Array as PropType<IDataViewItem[]>,
		default: () => [],
	},
	//  空数据提示
	emptyText: {
		type: String,
		default: '',
	},
	emptyTextPSLanguageRes: {
		type: String,
		default: '',
	},
	selections: {
		type: Array as PropType<IParam[]>,
		default: () => [],
	},
	cardOpts: {
		type: Object as PropType<CardOptions>,
		default: () => {},
	},
	totalRecord: {
		type: Number,
		default: 0,
	},
	loadMore: {
		type: Boolean,
		default: true,
	},
};

export interface IDataViewItem extends IParam {
	/**
	 * 主键
	 *
	 * @type {string}
	 * @memberof IDataViewItem
	 */
	srfkey: string;

	/**
	 * 主信息
	 *
	 * @type {string}
	 * @memberof IDataViewItem
	 */
	srfmajortext: string;

	/**
	 * 描述
	 *
	 * @type {string}
	 * @memberof IDataViewItem
	 */
	srfdescription?: string;

	/**
	 * 图标
	 *
	 * @type {string}
	 * @memberof IDataViewItem
	 */
	srficon?: string;
}

const dataViewItemProps = {
	item: {
		type: Object as PropType<IDataViewItem>,
		default: () => {},
	},
};

export const DataViewProps = dataViewProps;
export const DataViewItemProps = dataViewItemProps;
